/**
 * 
 */
package mx.netbrain.bean;

import java.util.List;

import mx.netbrain.dao.ThemeDao;
import mx.netbrain.dao.impl.ThemeDaoImpl;
import mx.netbrain.model.Theme;

/**
 * @author julian
 * 
 */
public class StyleBean {

	private List<Theme> listTheme;
	private Theme theme = new Theme();
	private Theme themeChange = new Theme();
	private String tema;

	public StyleBean() {
		ThemeDao themeDao = new ThemeDaoImpl();
		theme = themeDao.findByInitial("si");
		tema = theme.getName();
	}

	public void prepareStyle(Integer id) {
		ThemeDao themeDao = new ThemeDaoImpl();
		theme.setInitial("no");
		themeDao.update(theme);
		themeChange = themeDao.findById(id);
		themeChange.setInitial("si");
		themeDao.update(themeChange);
		tema = themeChange.getName();
	}

	public List<Theme> getListTheme() {
		ThemeDao themeDao = new ThemeDaoImpl();
		listTheme = themeDao.listAll();
		return listTheme;
	}

	public void setListTheme(List<Theme> listTheme) {
		this.listTheme = listTheme;
	}

	public String getTema() {
		return tema;
	}

	public void setTema(String tema) {
		this.tema = tema;
	}

}